/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package dao;

import controle_visao.FRMetapa;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import modelo.Etapa;

/**
 *
 * @author Aluno
 */
public class EtapaDAO {
    Connection conn;
    public EtapaDAO() {
        try {
            conn = new Conexao().getConexao();
        } catch (SQLException ex) {
            Logger.getLogger(EtapaDAO.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    public void inserir(Etapa et){
        String sql = "INSERT INTO etapa " + "(descricao,data,local,id)" + "VALUES (?,?,?,?)";
           try
               (PreparedStatement pstmt = this.conn.prepareStatement(sql)){
               pstmt.setString(1,sql);
           } catch (SQLException ex) { 
            System.out.println("SQLException em adicionar"+ "erro detectado"+ex.getMessage());
        } 
         
    }
     public void excluir(int id_etapa){
         String sql = "DELETE FROM etapa WHERE id_etapa" + id_etapa;
         try
             (Statement stmt = this.conn.createStatement()){
             
         } catch (SQLException ex) {
          System.out.println("SQLException em excluir "+ "erro detectado"+ex.getMessage());
        }
}
      public void alterar(){
         String sql = "UPDATE apoiador SET"+
                     "descricao,data,local,id_apoio"+
                     "WHERE id_apoio";
      }
       public ArrayList<Etapa> consultar(){
        String sql = "SELECT FROM etapa WHERE data "+ "LIKE" + "1 ORDER BY data ";
           ArrayList <Etapa>Etapa = new ArrayList<>();
           FRMetapa et;
           try 
               (Statement stmt = this.conn.createStatement();
                ResultSet rs = stmt.executeQuery(sql);){
               while(rs.next()){
                   et = new FRMetapa() ;
                  
                }
           } catch (SQLException ex) {
            System.out.println("SQLException em consultar" + "erro detectado"+ ex.getMessage());
        }
           
           return null;
       }
       public ArrayList<Etapa> listar(){
        String sql = "SELECT*from  etapa";
        ArrayList <Etapa>Etapa = new ArrayList<>(); 
        try(Statement stmt = this.conn.createStatement();
            ResultSet rs = stmt.executeQuery(sql); ){
            
        } catch (SQLException ex) {
            System.out.println("SQLExceptino em listar" + "erro detectado" + ex.getMessage() );
        }
        
        
        return null;
        
           
       } 
       }
